package com.carp.common;

import lombok.AllArgsConstructor;
import lombok.Data;

@Data
@AllArgsConstructor
public class DBResult {
     private Integer code;
     private String msg;
     private Object data;

    //请求成功
    public static DBResult success(Object data){
        return new DBResult(200,"成功!",data);
    }

    //请求失败
    public static DBResult error(){
        return new DBResult(500,"请求数据失败!",null);
    }

    //请求失败-自定义描述信息
    public static DBResult error(Integer code,String msg){
        return new DBResult(code,msg,null);
    }
}
